<template>
  <div>
    <van-popup
      :value="showModal"
      @click-overlay="overlay"
      position="top"
      transition="transition-none"
      class="bg-transparent"
    >
      <ul class="drop-wrap" v-if="showModal">
        <li @click="change(item)" v-for="(item,index) in list" :key="index">{{item.name}}</li>
      </ul>
    </van-popup>
  </div>
</template>

<script>
export default {
  props: ["show", "list"],
  data() {
    return {};
  },
  computed: {
    showModal() {
      return this.show;
    }
  },
  methods: {
    change(item) {
      this.$emit("change", item);
    },
    showPopup() {
      this.show = true;
    },
    overlay() {
      this.$emit("close");
    }
  }
};
</script> 
<style lang="less" scoped>
.bg-transparent {
  background-color: transparent;
}
.drop-wrap {
  padding-top: 15px;
  position: relative;
  border-radius: 3px;
  &::after {
    border: 15px solid transparent;
    border-bottom-color: #fff;
    content: " ";
    width: 0;
    height: 0;
    top: -10px;
    right: 10px;
    position: absolute;
  }
  li {
    background: #fff;
    list-style: none;
    line-height: 36px;
    padding: 0 20px;
    margin: 0;
    font-size: 14px;
    color: #000;
    cursor: pointer;
    outline: none;
    border-top: 1px solid #ebeef5;
    &:first-child {
      border-radius: 3px 3px 0 0;
    }
    &:last-child {
      border-radius: 0 0 3px 3px;
    }
  }
}
</style>

